#version 320 es
#ifdef GL_ES
	precision highp float;
#endif
#include "fadeOut.glsl"

out vec4 FragColor;

in vec2 ioTexcoord;

uniform sampler2D textureImg;

// material parameters
struct Material {
	vec3 baseColor;
	float metallic;
	float roughness;
};
uniform Material material;

uniform bool mixColorEnabled;

uniform bool isZhiche;

// ----------------------------------------------------------------------------
void main()
{
	FragColor = texture(textureImg, ioTexcoord);
	if (FragColor.a < 0.1) {
		FragColor.a = 0.0;
	} else if (!isZhiche) {
		if (mixColorEnabled)
			FragColor = mix(FragColor, vec4(material.baseColor, 1.0), 0.6);
		FragColor = vec4(fadeOutView3dEdge(FragColor.rgb), FragColor.a);
	}
}